import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
const router = createBrowserRouter([
  {
    path: "/",
    element: <App />,
    children: [
      {
        path: "home",
        lazy: async () => {
          const { default: Home } = await import("../page/home/Index");
          return { element: <Home /> };
        },
      },
      {
          path: "order",
          lazy: async () => {
              const { default: Order } = await import('../page/order/Index')
              return {element:<Order/>}
          }
        },
        {
            path: 'user',
            lazy: async () => {
                const { default: User } = await import('../page/user/Index')
                return {element:<User/>}
            }
        },
        {
            path: 'my',
            lazy: async () => {
                const {default:My}=await import('../page/my/Index')
                return {element:<My/>}
            }
        }
    ],
    },
    {
        path: 'login',
        lazy: async () => {
            const { default: Login } = await import('../page/login/Index')
            return {element:<Login/>}
        }
    },
    {
        path: '*',
        lazy: async () => {
            const { default: Error } = await import('../page/404/Index')
            return {element:<Error/>}
        }
    }
]);
export default router